package com.kuaiyin.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.Map;

@Data
@Schema(name = "TestCaseDTO", description = "创建测试用例参数")
public class TestCaseDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "用例ID（更新时必填，创建时无需填）")
    private Long id;

    @Schema(description = "用例名称（唯一）", example = "用户登录测试", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "用例名称不能为空")
    @Size(max = 64, message = "用例名称长度不能超过64字符")
    private String name;

    @Schema(description = "关联请求ID", example = "123", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "请求ID不能为空")
    @Positive(message = "请求ID必须为正数")
    private Long requestId;

    @Schema(description = "关联的环境类型",example = "TEST")
    private String environmentType; // DEV, TEST, STAGING, PROD

    @Schema(description = "数据驱动参数（JSON数组）", example = "{\"username\":\"test\"}")
    private Map<String, Object> dataDriven;

    @Schema(description = "前置脚本（如数据准备）")
    private String preScript;

    @Schema(description = "后置脚本（如数据库校验）")
    private String postScript;

    @Schema(description = "断言规则（JSON数组）")
    private Map<String, Object> assertions;

    @Schema(description = "状态：0-禁用 1-启用")
    private Integer status;
}